import axios from 'axios'
import qs from 'qs'
// 创建一个axios实例
const request = axios.create({
  baseURL: '/conner',
  timeout: 10000
})

// 添加拦截器
request.interceptors.request.use(function (config) {
  if (config.method === 'post' && config.data) {
    config.data = qs.stringify(config.data)
  }
  return config
}, function (error) {
  return Promise.reject(error)
})

request.interceptors.response.use(function (response) {
  return response
}, function (error) {
  return Promise.reject(error)
})

export default request
